<!---
/** 
* Copyright 2010 Cristian Costantini - Millemultimedia.it
* License: http://www.gnu.org/licenses/gpl-3.0.html
* @author  Cristian Costantini | cristian@millemultimedia.it
*/
--->
<cfsilent>

<cfset scope = "request" />
<cfset core = "fileManager" />
<cfset serviceName = "FileManager" />

<cffunction name="callMethod" access="private" returntype="any">
	<cfargument name="methodName" type="string" required="true" />
	<cfargument name="args" type="struct" required="true" />
	<cfset var target = evaluate( "#scope#.#core#" ) />
	<cfset var result = "" />
	
	<cfset result = target.invokeServiceMethod( variables.serviceName, arguments.methodName, arguments.args ) />
				  
	<cfreturn result />
</cffunction>

<cfset result = "" />
<cfset params = structNew() />
<cfset params.put( "fileField", 'form-file' )/>
<cfset params.put( "destination", form.destinationPath )/>
    
<cfset result = callMethod( 'uploadFile', params ) />

</cfsilent><cfcontent type="text/html"><cfoutput>#serializeJson( result )#</cfoutput>
